| Conditions | 2 |
| Paths | 11 |
| Total Lines | 18 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | var exports = module.exports = {}; |
||
| 21 | exports.writeConfig = function(params) { |
||
| 22 | var contents; |
||
| 23 | try { |
||
| 24 | if(exports.hasConfig()) { |
||
| 25 | contents = fs.readFileSync(configFile).toString(); |
||
| 26 | } else { |
||
| 27 | contents = fs.readFileSync(defaultConfigFile).toString(); |
||
| 28 | } |
||
| 29 | |||
| 30 | console.log(contents); |
||
| 31 | contents = contents.replace(/key=[\s\S]+$/,'key='+params['mapQuestKey']); |
||
| 32 | fs.writeFileSync(configFile, contents); |
||
| 33 | return true; |
||
| 34 | } catch(e) { |
||
| 35 | console.log(e); |
||
| 36 | return false; |
||
| 37 | } |
||
| 38 | }; |
||
| 39 |